package com.snow.useviewdemo.animation;

import android.content.Intent;
import android.os.Bundle;

import com.snow.useviewdemo.R;
import com.snow.useviewdemo.base.BaseViewBindingActivity;
import com.snow.useviewdemo.databinding.ActivityOptFirstBinding;

/**
 * Created by zhyt
 * Date: 2022/3/14
 * Describe:
 * overridePendingTransition(int enterAnim, int exitAnim)两个参数，一个进入动画，一个退出动画，
 * 进入的动画设置：
 * overridePendingTransition()除了放在startActivity或者startActivityForResult之后也可以放在
 * 即将打开的activity的开始生命周期任何位置都有效，但放置时机不能超过activity的显示时间，你可以放如下代码的任何位置；
 *
 * 退出的动画设置：
 * overridePendingTransition()只能放在finish()之后才生效。
 *
 * 事例：
 *     @Override
 *     protected void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
 *        位置1 overridePendingTransition(R.anim.activity_bottom_to_top, R.anim.anim_no);
 *         super.onCreate(savedInstanceState);
 *         位置2 overridePendingTransition(R.anim.activity_bottom_to_top, R.anim.anim_no);
 *     }
 *
 *     @Override
 *     protected void onStart() {
 *         位置3 overridePendingTransition(R.anim.activity_bottom_to_top, R.anim.anim_no);
 *         super.onStart();
 *         位置4 overridePendingTransition(R.anim.activity_bottom_to_top, R.anim.anim_no);
 *     }
 *
 *     @Override
 *     protected void onResume() {
 *         位置5 overridePendingTransition(R.anim.activity_bottom_to_top, R.anim.anim_no);
 *         super.onResume();
 *         位置6 overridePendingTransition(R.anim.activity_bottom_to_top, R.anim.anim_no);
 *
 *     }
 *
 */
public class OPTFirstActivity extends BaseViewBindingActivity<ActivityOptFirstBinding> {
    @Override
    protected ActivityOptFirstBinding getViewBinding() {
        if (mBinding == null) {
            mBinding = ActivityOptFirstBinding.inflate(getLayoutInflater());
        }
        return mBinding;
    }

    @Override
    protected void setViewData(Bundle savedInstanceState) {
        mBinding.button.setOnClickListener(view -> {
            startActivity(new Intent(OPTFirstActivity.this, OPTSecondActivity.class));

        });
    }
}
